package com.auxgroup.hr.front.dao.domain;

/**
 * 加班申请
 * Created by nitongqian on 2019/3/2.
 */

import com.auxgroup.hr.front.commons.enums.WfTypeEnum;
import com.fasterxml.jackson.annotation.JsonFormat;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;

/**
 * 加班
 */
@Entity
@Table(name = "PS_C_WF_WKOT_HDR")
@NamedQuery(name = "PsCWfWkotHdr.findAll", query = "SELECT p FROM PsCWfWkotHdr p")
public class PsCWfWkotHdr extends AbsWfEmplDomain {

    @Column(name = "EMPLID")
    private String emplid;
    @Column(name = "EMPL_RCD")
    private BigDecimal emplRcd;
    @Column(name = "NAME_DISPLAY")
    private String nameDisplay;
    @Column(name = "SEX")
    private String sex;
    @Temporal(TemporalType.DATE)
    @Column(name = "BIRTHDATE")
    private Date birthdate;
    @Column(name = "MAR_STATUS")
    private String marStatus;
    @Column(name = "C_BEAR")
    private String cBear;
    @Column(name = "BUSINESS_UNIT")
    private String businessUnit;
    @Column(name = "C_BUSN_DESCR")
    private String cBusnDescr;
    @Column(name = "SETID_DEPT")
    private String setidDept;
    @Column(name = "SETID")
    private String setid;
    @Column(name = "DEPTID")
    private String deptid;
    @Column(name = "C_ORG_FULLNAME")
    private String cOrgFullname;
    @Column(name = "RS_FULL_NAME")
    private String rsFullName;
    @Column(name = "DEPT_DESCR")
    private String deptDescr;
    @Column(name = "DESCRSHORT")
    private String descrshort;
    @Column(name = "C_DEPT_LEVEL")
    private String cDeptLevel;
    @Column(name = "SETID_JOBCODE")
    private String setidJobcode;
    @Column(name = "JOBCODE")
    private String jobcode;
    @Column(name = "JOBCODE_DESCR")
    private String jobcodeDescr;
    @Column(name = "C_JOBCODE")
    private String cJobcode;
    @Column(name = "JOB_FUNCTION")
    private String jobFunction;
    @Column(name = "LOCATION")
    private String location;
    @Column(name = "C_JOB_LEVEL")
    private String cJobLevel;
    @Column(name = "RS_JOB_LEVEL")
    private String rsJobLevel;
    @Column(name = "C_AUX_SYSTEM")
    private String cAuxSystem;
    @Temporal(TemporalType.DATE)
    @Column(name = "START_DT_CHN")
    private Date startDtChn;
    @Temporal(TemporalType.DATE)
    @Column(name = "C_WKLIF_BGN_DT")
    private Date cWklifBgnDt;
    @Temporal(TemporalType.DATE)
    @Column(name = "RS_WKLIF_BGN_DT")
    private Date rsWklifBgnDt;
    @Temporal(TemporalType.DATE)
    @Column(name = "LAST_HIRE_DT")
    private Date lastHireDt;
    @Column(name = "HIGHEST_EDUC_LVL")
    private String highestEducLvl;
    @Column(name = "C_SCHOOL")
    private String cSchool;
    @Column(name = "C_MAJOR")
    private String cMajor;
    @Column(name = "C_EMPL_FROM")
    private String cEmplFrom;
    @Column(name = "C_EMPLID")
    private String cEmplid;
    @Column(name = "C_NAME")
    private String cName;
    @Column(name = "PHONE")
    private String phone;
    @Column(name = "C_FINANCIAL_STAFF")
    private String cFinancialStaff;
    @Column(name = "C_IS_DEPT_MGR")
    private String cIsDeptMgr;
    @Column(name = "C_IS_DXS")
    private String cIsDxs;
    @Column(name = "C_IS_GWHCY")
    private String cIsGwhcy;
    @Column(name = "C_IS_GROUP_MGR")
    private String cIsGroupMgr;
    @Column(name = "C_IS_SYB_MGR")
    private String cIsSybMgr;
    @Column(name = "C_IS_CPY_MGR")
    private String cIsCpyMgr;
    @Column(name = "C_JOB_TYPE")
    private String cJobType;
    @Column(name = "C_WF_COMPANY2")
    private String cWfCompany2;
    @Column(name = "C_OVER_TIME_DAY")
    private BigDecimal cOverTimeDay;


    //刷卡类型
    @Column(name = "C_CARD_TYPE")
    private String cCardType;
    //日期1
//    @Temporal(TemporalType.DATE)
    @Column(name = "DATE1")
    private Date date1;
    //小时下拉选
    @Column(name = "C_HOUR")
    private String cHour;
    //分钟下拉选
    @Column(name = "C_MINUTE2")
    private String cMinute2;
    //日期2
    @Temporal(TemporalType.DATE)
    @Column(name = "DATE2")
    private Date date2;
    //小时下拉选
    @Column(name = "C_HOUR1")
    private String cHour1;
    //分钟下拉选
    @Column(name = "C_MINUTE3")
    private String cMinute3;
    //是否
    @Column(name = "C_YES_NO")
    private String cYesNo;
    //申请详细说明
    @Column(name = "C_APPL_INFO")
    private String cApplInfo;

    public BigDecimal getcOverTimeDay() {
        return cOverTimeDay;
    }

    public void setcOverTimeDay(BigDecimal cOverTimeDay) {
        this.cOverTimeDay = cOverTimeDay;
    }

    public BigDecimal getEmplRcd() {
        return emplRcd;
    }

    public void setEmplRcd(BigDecimal emplRcd) {
        this.emplRcd = emplRcd;
    }

    public String getEmplid() {
        return emplid;
    }

    public void setEmplid(String emplid) {
        this.emplid = emplid;
    }

    public PsCWfWkotHdr() {
    }

    @Override
    public void baseInit(AbsWfEmplDomain source) {
        PsCWfWkotHdr from = (PsCWfWkotHdr) source;
        setcWfType(WfTypeEnum.WF_STYPE_OVRT.getType());// 流程类别
        this.setcApplInfo(from.getcApplInfo());
        this.setcCardType(from.getcCardType());
        this.setcHour(from.getcHour());
        this.setcMinute2(from.getcMinute2());
        this.setcMinute3(from.getcMinute3());
        this.setcHour1(from.getcHour1());
        this.setcYesNo(from.getcYesNo());
        this.setDate1(from.getDate1());
        this.setDate2(from.getDate2());

        Calendar c = Calendar.getInstance();
        c.setTime(from.getDate1());
        c.set(c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH), Integer.valueOf(from.getcHour().substring(1)), Integer.valueOf(from.getcMinute2()));
        Date startDate = c.getTime();

        c.setTime(from.getDate2());
        c.set(c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH), Integer.valueOf(from.getcHour1().substring(1)), Integer.valueOf(from.getcMinute2()));
        Date endDate = c.getTime();
        long day = (endDate.getTime() - startDate.getTime()) * 10 / 1000 / 60 / 60 / 7;
        double outDay = (int) (day * 1.0 / 10);
        if (day % 10 >= 5) {
            outDay += 0.5;
        }
        this.setcOverTimeDay(new BigDecimal(outDay));
    }

    public void fill4Self(PsCWfEmpVw vw) {
        emplid = vw.getEmplid();
        emplRcd = vw.getEmplRcd();
        nameDisplay = vw.getNameDisplay();
        sex = vw.getSex();
        birthdate = vw.getBirthdate();
        marStatus = vw.getMarStatus();
        cBear = vw.getcBear();
        businessUnit = vw.getBusinessUnit();
        cBusnDescr = vw.getcBusnDescr();
//        setidDept = vw.getSetid;
        setid = vw.getSetid();
        deptid = vw.getDeptid();
//        cOrgFullname = vw.;
        rsFullName = vw.getRsFullName();
        deptDescr = vw.getDeptDescr();
        descrshort = vw.getDescrshort();
        cDeptLevel = vw.getcDeptLevel();
        setidJobcode = vw.getSetidJobCode();
        jobcode = vw.getJobcode();
        jobcodeDescr = vw.getJobcodeDescr();
//        cJobcode = vw.getcJ;
        jobFunction = vw.getJobFunction();
        location = vw.getLocation();
        cJobLevel = vw.getcJobLevel();
        rsJobLevel = vw.getRsJobLevel();
        cAuxSystem = vw.getcAuxSystem();
        startDtChn = vw.getStartDtChn();
//        cWklifBgnDt = vw.g;
//        rsWklifBgnDt = vw.;
        lastHireDt = vw.getLastHireDt();
        highestEducLvl = vw.getHighestEducLvl();
        cSchool = vw.getcSchool();
        cMajor = vw.getcMajor();
        cEmplFrom = vw.getcEmplFrom();
        cEmplid = vw.getcEmplid();
//        cName = vw.getNameDisplay();
        phone = vw.getPhone();
//        cFinancialStaff = vw.g;
        cIsDeptMgr = vw.getcIsDeptMgr();
        cIsDxs = vw.getcIsDxs();
        cIsGwhcy = vw.getcIsGwhcy();
        cIsGroupMgr = vw.getcIsGroupMgr();
        cIsSybMgr = vw.getcIsSybMgr();
        cIsCpyMgr = vw.getcIsCpyMgr();
        cJobType = vw.getcJobType();
        cWfCompany2 = vw.getcWfCompany2();
    }

    public String getcCardType() {
        return cCardType;
    }

    public void setcCardType(String cCardType) {
        this.cCardType = cCardType;
    }


    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    public Date getDate1() {
        return date1;
    }

    public void setDate1(Date date1) {
        this.date1 = date1;
    }

    public String getcHour() {
        return cHour;
    }

    public void setcHour(String cHour) {
        this.cHour = cHour;
    }

    public String getcMinute2() {
        return cMinute2;
    }

    public void setcMinute2(String cMinute2) {
        this.cMinute2 = cMinute2;
    }

    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    public Date getDate2() {
        return date2;
    }

    public void setDate2(Date date2) {
        this.date2 = date2;
    }

    public String getcHour1() {
        return cHour1;
    }

    public void setcHour1(String cHour1) {
        this.cHour1 = cHour1;
    }

    public String getcMinute3() {
        return cMinute3;
    }

    public void setcMinute3(String cMinute3) {
        this.cMinute3 = cMinute3;
    }

    public String getcYesNo() {
        return cYesNo;
    }

    public void setcYesNo(String cYesNo) {
        this.cYesNo = cYesNo;
    }

    public String getcApplInfo() {
        return cApplInfo;
    }

    public void setcApplInfo(String cApplInfo) {
        this.cApplInfo = cApplInfo;
    }


    public String getNameDisplay() {
        return nameDisplay;
    }

    public void setNameDisplay(String nameDisplay) {
        this.nameDisplay = nameDisplay;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public Date getBirthdate() {
        return birthdate;
    }

    public void setBirthdate(Date birthdate) {
        this.birthdate = birthdate;
    }

    public String getMarStatus() {
        return marStatus;
    }

    public void setMarStatus(String marStatus) {
        this.marStatus = marStatus;
    }

    public String getcBear() {
        return cBear;
    }

    public void setcBear(String cBear) {
        this.cBear = cBear;
    }

    public String getBusinessUnit() {
        return businessUnit;
    }

    public void setBusinessUnit(String businessUnit) {
        this.businessUnit = businessUnit;
    }

    public String getcBusnDescr() {
        return cBusnDescr;
    }

    public void setcBusnDescr(String cBusnDescr) {
        this.cBusnDescr = cBusnDescr;
    }

    public String getSetidDept() {
        return setidDept;
    }

    public void setSetidDept(String setidDept) {
        this.setidDept = setidDept;
    }

    public String getSetid() {
        return setid;
    }

    public void setSetid(String setid) {
        this.setid = setid;
    }

    public String getDeptid() {
        return deptid;
    }

    public void setDeptid(String deptid) {
        this.deptid = deptid;
    }

    public String getcOrgFullname() {
        return cOrgFullname;
    }

    public void setcOrgFullname(String cOrgFullname) {
        this.cOrgFullname = cOrgFullname;
    }

    public String getRsFullName() {
        return rsFullName;
    }

    public void setRsFullName(String rsFullName) {
        this.rsFullName = rsFullName;
    }

    public String getDeptDescr() {
        return deptDescr;
    }

    public void setDeptDescr(String deptDescr) {
        this.deptDescr = deptDescr;
    }

    public String getDescrshort() {
        return descrshort;
    }

    public void setDescrshort(String descrshort) {
        this.descrshort = descrshort;
    }

    public String getcDeptLevel() {
        return cDeptLevel;
    }

    public void setcDeptLevel(String cDeptLevel) {
        this.cDeptLevel = cDeptLevel;
    }

    public String getSetidJobcode() {
        return setidJobcode;
    }

    public void setSetidJobcode(String setidJobcode) {
        this.setidJobcode = setidJobcode;
    }

    public String getJobcode() {
        return jobcode;
    }

    public void setJobcode(String jobcode) {
        this.jobcode = jobcode;
    }

    public String getJobcodeDescr() {
        return jobcodeDescr;
    }

    public void setJobcodeDescr(String jobcodeDescr) {
        this.jobcodeDescr = jobcodeDescr;
    }

    public String getcJobcode() {
        return cJobcode;
    }

    public void setcJobcode(String cJobcode) {
        this.cJobcode = cJobcode;
    }

    public String getJobFunction() {
        return jobFunction;
    }

    public void setJobFunction(String jobFunction) {
        this.jobFunction = jobFunction;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public String getcJobLevel() {
        return cJobLevel;
    }

    public void setcJobLevel(String cJobLevel) {
        this.cJobLevel = cJobLevel;
    }

    public String getRsJobLevel() {
        return rsJobLevel;
    }

    public void setRsJobLevel(String rsJobLevel) {
        this.rsJobLevel = rsJobLevel;
    }

    public String getcAuxSystem() {
        return cAuxSystem;
    }

    public void setcAuxSystem(String cAuxSystem) {
        this.cAuxSystem = cAuxSystem;
    }

    public Date getStartDtChn() {
        return startDtChn;
    }

    public void setStartDtChn(Date startDtChn) {
        this.startDtChn = startDtChn;
    }

    public Date getcWklifBgnDt() {
        return cWklifBgnDt;
    }

    public void setcWklifBgnDt(Date cWklifBgnDt) {
        this.cWklifBgnDt = cWklifBgnDt;
    }

    public Date getRsWklifBgnDt() {
        return rsWklifBgnDt;
    }

    public void setRsWklifBgnDt(Date rsWklifBgnDt) {
        this.rsWklifBgnDt = rsWklifBgnDt;
    }

    public Date getLastHireDt() {
        return lastHireDt;
    }

    public void setLastHireDt(Date lastHireDt) {
        this.lastHireDt = lastHireDt;
    }

    public String getHighestEducLvl() {
        return highestEducLvl;
    }

    public void setHighestEducLvl(String highestEducLvl) {
        this.highestEducLvl = highestEducLvl;
    }

    public String getcSchool() {
        return cSchool;
    }

    public void setcSchool(String cSchool) {
        this.cSchool = cSchool;
    }

    public String getcMajor() {
        return cMajor;
    }

    public void setcMajor(String cMajor) {
        this.cMajor = cMajor;
    }

    public String getcEmplFrom() {
        return cEmplFrom;
    }

    public void setcEmplFrom(String cEmplFrom) {
        this.cEmplFrom = cEmplFrom;
    }

    public String getcEmplid() {
        return cEmplid;
    }

    public void setcEmplid(String cEmplid) {
        this.cEmplid = cEmplid;
    }

    public String getcName() {
        return cName;
    }

    public void setcName(String cName) {
        this.cName = cName;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getcFinancialStaff() {
        return cFinancialStaff;
    }

    public void setcFinancialStaff(String cFinancialStaff) {
        this.cFinancialStaff = cFinancialStaff;
    }

    public String getcIsDeptMgr() {
        return cIsDeptMgr;
    }

    public void setcIsDeptMgr(String cIsDeptMgr) {
        this.cIsDeptMgr = cIsDeptMgr;
    }

    public String getcIsDxs() {
        return cIsDxs;
    }

    public void setcIsDxs(String cIsDxs) {
        this.cIsDxs = cIsDxs;
    }

    public String getcIsGwhcy() {
        return cIsGwhcy;
    }

    public void setcIsGwhcy(String cIsGwhcy) {
        this.cIsGwhcy = cIsGwhcy;
    }

    public String getcIsGroupMgr() {
        return cIsGroupMgr;
    }

    public void setcIsGroupMgr(String cIsGroupMgr) {
        this.cIsGroupMgr = cIsGroupMgr;
    }

    public String getcIsSybMgr() {
        return cIsSybMgr;
    }

    public void setcIsSybMgr(String cIsSybMgr) {
        this.cIsSybMgr = cIsSybMgr;
    }

    public String getcIsCpyMgr() {
        return cIsCpyMgr;
    }

    public void setcIsCpyMgr(String cIsCpyMgr) {
        this.cIsCpyMgr = cIsCpyMgr;
    }

    public String getcJobType() {
        return cJobType;
    }

    public void setcJobType(String cJobType) {
        this.cJobType = cJobType;
    }

    public String getcWfCompany2() {
        return cWfCompany2;
    }

    public void setcWfCompany2(String cWfCompany2) {
        this.cWfCompany2 = cWfCompany2;
    }

}
